extends CharacterBody2D
class_name Character

@export var health : int
@export var damage : int
@export var speed : float

var last_velocity = Vector2.ZERO
func _process(delta: float) -> void:
	var direction := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
	if direction == Vector2.ZERO:
		if Input.is_action_just_pressed("ui_left"):
			last_velocity = Vector2.LEFT
		elif Input.is_action_just_pressed("ui_right"):
			last_velocity = Vector2.RIGHT
		elif Input.is_action_just_pressed("ui_up"):
			last_velocity = Vector2.UP
		elif Input.is_action_just_pressed("ui_down"):
			last_velocity = Vector2.DOWN
	else:
		last_velocity = Vector2.ZERO
	
	direction += last_velocity
	#print(direction)
	position += direction * delta * speed
	#velocity = direction * speed
	#move_and_slide()
